# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=shitflood
pkgver=14.e74fc42
pkgrel=4
groups=('blackarch' 'blackarch-dos')
pkgdesc='A Socks5 clone flooder for the Internet Relay Chat (IRC) protocol.'
arch=('any')
url='https://github.com/acidvegas/shitflood'
license=('custom:unknown')
depends=('python2')
makedepends=('git')
source=("git+https://github.com/acidvegas/$pkgname.git"
        "$pkgname.py.patch")
sha512sums=('SKIP'
            '703c894f3f20eb5a276ec8df7b43e2a17d7ae616e0a8e58f2cb214991cd49b242a6f5ae60320bb498fa18f8ff076af882d917bf07018f567dc3f6081b5dac0fd')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  patch -p1 < "$pkgname.py.patch"
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md

  rm README.md

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

